/**this app is used to show the function fo tranlate data from
  src_file to dest_file
  include func open,read,write*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <unistd.h>

int main(void){
	char buff[1024];
	int fd1,fd2;
	int ret;

	fd1=open("./src_file",O_RDONLY);
	if(-1==fd1){
		return fd1;
	}

	fd2=open("./dest_file",O_WRONLY);
	if(-1==fd2){
		ret=fd2;
		goto out1;
	}

	ret=read(fd1,buff,sizeof(buff));
	if(-1==ret)
		goto out2;

	ret=write(fd2,buff,sizeof(buff));
	if(-1==ret)
		goto out2;
	ret=0;
out2:
	close(fd2);
out1:
	close(fd1);
	return ret;
}
